﻿using Icinetic.FeedCategorySample.Entities;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FeedCategorySample.Test
{
    public class DataHelper
    {
        public static RssItem NewRssItem(int index = 1)
        {
            DateTime now = DateTime.Now;
            return new RssItem
            {
                Category = "TestCategory",
                ColPortraitSpan = index,
                RowPortraitSpan = index,
                ColSpan = index,
                RowSpan = index,
                Content = Guid.NewGuid().ToString(),
                Date = now.ToString(),
                DateArticle = now,
                ExpirationDate = now,
                Image = "ImageTest",
                IsRead = false,
                Link = "TestLink",
                Title = "RssItem " + index.ToString(),
                TitleAll = "RssItem " + index.ToString()
            };
        }
        
        public static System.Collections.ObjectModel.ObservableCollection<Category> NewCategoryObservableCollection()
        {
            return new ObservableCollection<Category>
            {
                NewCategory()
            };
        }

        private static Category NewCategory()
        {
            return new Category
            {
                Title = "TestCategory",
                ColSpan = 2,
                RowSpan = 1,
                Image = "TestImage.png",
                Color = "#0099AB",
                Articles = new ObservableCollection<RssItem>(NewRssItemList())
            };
        }

        private static List<RssItem> NewRssItemList()
        {
            List<RssItem> rssItemList = new List<RssItem>();
            for (int i = 0; i < 10; i++)
            {
                rssItemList.Add(NewRssItem(i));
            }
            return rssItemList;
        }
    }
}
